
import logging
import os

from common.osPath import dirName

from logging.handlers import SysLogHandler



class Logger():
    def __init__(self):
        self.logger=logging.getLogger()
        self.logger.setLevel(logging.DEBUG)

        stream_handle=logging.StreamHandler()
        stream_handle.setLevel(logging.DEBUG)


        file_handle=logging.FileHandler(os.path.join(dirName(),'log\log.log'),'w+',encoding='utf-8')
        file_handle.setLevel(logging.INFO)


        fmt="%(asctime)s  %(levelname)s  %(message)s"
        formatter=logging.Formatter(fmt)

        stream_handle.setFormatter(formatter)
        file_handle.setFormatter(formatter)
        

        self.logger.addHandler(stream_handle)
        self.logger.addHandler(file_handle)

test_log=Logger().logger

